package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.BaseData;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.wxcomment.CommentVo;
import com.cskaoyan.bean.wxcomment.PostBean;
import com.cskaoyan.bean.wxcomment.WxCommentsBo;
import com.cskaoyan.bean.wxcomment.WxCommentsCountVo;
import com.cskaoyan.service.CommentService;
import com.cskaoyan.service.WxCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * \* Description:
 * \
 */
@RestController
@RequestMapping("wx/comment")
public class WXCommentController {

    @Autowired
    WxCommentService wxCommentService;

    //
    @GetMapping("list")
    public BaseRespVo comment( WxCommentsBo wxCommentsBo) {

        BaseData<CommentVo> data = wxCommentService.comment(wxCommentsBo);

        return BaseRespVo.ok(data);
    }

    @GetMapping("count")
    public BaseRespVo count (Integer valueId,Integer type){
        WxCommentsCountVo data = wxCommentService.count(valueId);
        return BaseRespVo.ok(data);
    }

    @PostMapping("post")
    public BaseRespVo postComment(@RequestBody PostBean postBean){
        wxCommentService.post(postBean);
        return BaseRespVo.ok();
    }

}
